<!DOCTYPE html>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<html>
	<head>
		<script src="<c:url value="/recursos/js/registro.js"/>"></script>
	</head>
	
	<body class="body-login">
	
		<section id="inner-headline">
			<div class="container">
				<div class="row">
					<div class="col-lg-12">
						<ul class="breadcrumb">
							<li><a href="<c:url value="/"/>"><i class="fa fa-home"></i></a><i class="icon-angle-right"></i></li>
							<li class="active">Criar Conta</li>
						</ul>
					</div>
				</div>
			</div>
		</section>
		
		<%@include file="mensagem.jsp" %>
		
		<section id="content">
			<div class="container">
				<div class="row">
				
					<div class="col-sm-12">
						<!-- #section:elements.tab.position -->
						<div class="tabbable tabs-left">
							<ul class="nav nav-tabs" id="myTab3">
								
								<spring:eval expression="tipoUsuario == T(br.com.wssa.smmb.enums.TipoUsuarioEnum).PESSOA_FISICA" var="isPessoaFisica"/>
								<c:choose>
									<c:when test="${isPessoaFisica}">
										<li class="active">
											<a data-toggle="tab" href="#pessoaFisica" aria-expanded="true">
												<i class="pink ace-icon fa fa-tachometer bigger-110"></i>
												Pessoa Fisíca
											</a>
										</li>
									</c:when>
									<c:otherwise>
										<li class="">
											<a data-toggle="tab" href="#pessoaFisica" aria-expanded="false">
												<i class="pink ace-icon fa fa-tachometer bigger-110"></i>
												Pessoa Fisíca
											</a>
										</li>
									</c:otherwise>
								</c:choose>
							
	
							
								<spring:eval expression="tipoUsuario == T(br.com.wssa.smmb.enums.TipoUsuarioEnum).PESSOA_JURIDICA" var="isPessoaJuridica"/>
								<c:choose>
									<c:when test="${isPessoaJuridica}">
										<li class="active">
											<a data-toggle="tab" href="#pessoaJuridica" aria-expanded="true">
												<i class="blue ace-icon fa fa-user bigger-110"></i>
												Pessoa Jurídica
											</a>
										</li>
									</c:when>
									<c:otherwise>
										<li class="">
											<a data-toggle="tab" href="#pessoaJuridica" aria-expanded="false">
												<i class="blue ace-icon fa fa-user bigger-110"></i>
												Pessoa Jurídica
											</a>
										</li>
									</c:otherwise>
								</c:choose>
								
							</ul>
		
							<div class="tab-content">
								<c:choose>
									<c:when test="${isPessoaFisica}">
										<div id="pessoaFisica" class="tab-pane active">
									</c:when>
									<c:otherwise>
										<div id="pessoaFisica" class="tab-pane">
									</c:otherwise>
								</c:choose>
								
									<article class="col-xs-11 maincontent">
										<div class="col-md-5 col-md-offset-4">
											<div class="panel panel-default">
												<div class="login-body">
													<h3 class="thin text-center">
														<i class="smmb-icon fa fa-users blue"></i>
														Cadastro Pessoa Física
													</h3>
				
													<hr>
													<sf:form modelAttribute="usuario" id="formRegistro">
														<input type="hidden" id="registroInvalido" value="${registroInvalido}">
														
														<div class="top-margin">
															<label for="nome">Nome Completo <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="nome" class="form-control"/>
																<i class="smmb-icon fa fa-user"></i>
																<sf:errors path="nome" cssClass="erro"/>
															</span>
														</div>
														
														
														<div class="top-margin">
															<label for="cpf">CPF <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="cpf" class="form-control"/>
																<i class="smmb-icon fa fa-user"></i>
																<sf:errors path="cpf" cssClass="erro"/>
															</span>
														</div>
														
														
														<div class="top-margin">
															<label for="telefone">Telefone <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="telefone" class="form-control"/>
																<i class="smmb-icon fa fa-phone"></i>
																<sf:errors path="telefone" cssClass="erro"/>
															</span>
														</div>
														
														
														<div class="top-margin">
															<label for="email">Email <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="email" class="form-control"/>
																<i class="smmb-icon fa fa-envelope"></i>
																<sf:errors path="email" cssClass="erro"/>
															</span>
														</div>
														
														
														<div class="col-lg-6 field top-margin input-senha">
															<label for="senha">Senha <span class="text-danger">*</span></label>
															<span class="block input-icon input-icon-right">
																<sf:password  path="senha" class="form-control"/>
																<i class="smmb-icon fa fa-lock"></i>
																<sf:errors path="senha" cssClass="erro"/>
															</span>
														</div>
														
														<div class="col-lg-6 field top-margin input-confirmaSenha">
															<label for="confirmaSenha">Confirma Senha <span class="text-danger">*</span></label>
															<span class="block input-icon input-icon-right">
																<sf:password  path="confirmaSenha" class="form-control" 
																	onkeypress="if(event.keyCode == 13) validarRegistro()"/>
																<i class="smmb-icon fa fa-retweet"></i>
																<sf:errors path="confirmaSenha" cssClass="erro"/>
															</span>
														</div>
				
														<div class="col-lg-12 space-6"></div>
														<div class="col-lg-12 space-6"></div>
				
														<div class="clearfix">
															<button type="button" class="pull-right btn btn-success" onclick="cadastrarPessoaFisica()"> 
																<i class="smmb-icon fa fa-key"></i>
																<span class="bigger-110">Cadastro</span>
															</button>
														</div>
														
														<div class="col-lg-12 space-6"></div>
													</sf:form>
												</div>
												
												<div class="toolbar clearfix">
													<div class="div-toolbar">
														<a href="javascript:void(0);" data-target="#forgot-box" class="forgot-password-link"
															onclick="ajaxURL('/entrar')">
														<i class="smmb-icon fa fa-arrow-left"></i>&nbsp;Login</a>
													</div>
												</div>
												
											</div>
										</div>
									</article>
								</div>
		
								<c:choose>
									<c:when test="${isPessoaJuridica}">
										<div id="pessoaJuridica" class="tab-pane active">
									</c:when>
									<c:otherwise>
										<div id="pessoaJuridica" class="tab-pane">
									</c:otherwise>
								</c:choose>
									<article class="col-xs-11 maincontent">
										<div class="col-md-5 col-md-offset-4">
											<div class="panel panel-default">
												<div class="login-body">
													<h3 class="thin text-center">
														<i class="smmb-icon fa fa-users blue"></i>
														Cadastro Pessoa Jurídica
													</h3>
				
													<hr>
													<sf:form modelAttribute="usuario" id="formRegistro">
														<input type="hidden" id="registroInvalido" value="${registroInvalido}">
														
														<div class="top-margin">
															<label for="nome">Nome Completo <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="nome" class="form-control"/>
																<i class="smmb-icon fa fa-user"></i>
																<sf:errors path="nome" cssClass="erro"/>
															</span>
														</div>
														
														<div class="top-margin">
															<label for="email">Email <span class="text-danger">*</span></label>
															
															<span class="block input-icon input-icon-right">
																<sf:input path="email" class="form-control"/>
																<i class="smmb-icon fa fa-envelope"></i>
																<sf:errors path="email" cssClass="erro"/>
															</span>
														</div>
														
														
														<div class="col-lg-6 field top-margin input-senha">
															<label for="senha">Senha <span class="text-danger">*</span></label>
															<span class="block input-icon input-icon-right">
																<sf:password  path="senha" class="form-control"/>
																<i class="smmb-icon fa fa-lock"></i>
																<sf:errors path="senha" cssClass="erro"/>
															</span>
														</div>
														
														<div class="col-lg-6 field top-margin input-confirmaSenha">
															<label for="confirmaSenha">Confirma Senha <span class="text-danger">*</span></label>
															<span class="block input-icon input-icon-right">
																<sf:password  path="confirmaSenha" class="form-control" 
																	onkeypress="if(event.keyCode == 13) validarRegistro()"/>
																<i class="smmb-icon fa fa-retweet"></i>
																<sf:errors path="confirmaSenha" cssClass="erro"/>
															</span>
														</div>
				
														<div class="col-lg-12 space-6"></div>
														<div class="col-lg-12 space-6"></div>
				
														<div class="clearfix">
															<button type="button" class="pull-right btn btn-success" onclick="cadastrarPessoaJuridica()"> 
																<i class="smmb-icon fa fa-key"></i>
																<span class="bigger-110">Cadastro</span>
															</button>
														</div>
														
														<div class="col-lg-12 space-6"></div>
													</sf:form>
												</div>
												
												<div class="toolbar clearfix">
													<div class="div-toolbar">
														<a href="javascript:void(0);" data-target="#forgot-box" class="forgot-password-link"
															onclick="ajaxURL('/entrar')">
														<i class="smmb-icon fa fa-arrow-left"></i>&nbsp;Login</a>
													</div>
												</div>
												
											</div>
										</div>
									</article>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="panel-body" style="display: none;">
				<form style="margin-top: 1.0em;" action="<c:url value="/j_spring_security_check"/>" method="post" id="formLogin">
					<div class="top-margin">
						<input type="text" name="j_username" class="form-control" value="${j_username}">
					</div>
					<div class="top-margin">
						<input type="password" name="j_password" class="form-control" value="${j_password}">
					</div>
				</form>
			</div>
		</section>
	</body>
</html>